#region Summary

// 
// Owner : JackieHan 
// 
// Solution : DailyCollection 
// 
// Project : Jackie.Utility.Compiler.Test
// 
// File : TestCodeScanner.cs
// 
// CopyRight : Copyright © 2010-2011 Skomart Corporation, All Rights Reserved 
// 
// Summary : 测试词法分析
// 
// History : 
//			2011-05-30 17:43:31	    Create 
// 

#endregion

#region Using

using System;
using Jackie.Utility.Compiler.Scanner;
using NUnit.Framework;

#endregion

namespace Jackie.Utility.Compiler.Test
{
    /// <summary> 
    /// 测试词法分析
    /// </summary>
    [TestFixture]
    public class TestCodeScanner
    {
        [Test]
        public void TestAddSign()
        {
            var express = "var price=100+200.00;";
            var scanner = new CodeScanner(express);

            var token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.VarKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Space, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("price", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("100", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Add, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("200.00", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestSubSign()
        {
            var express = "var price=100-200.00;";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.VarKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Space, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("price", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("100", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Sub, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("200.00", token.Value);
            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestMulSign()
        {
            var express = "var price=100*200.00;";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.VarKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Space, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("price", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("100", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Mul, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("200.00", token.Value);
            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestDivSign()
        {
            var express = "var price=100/200.00;";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.VarKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Space, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("price", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("100", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Div, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("200.00", token.Value);
            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestModSign()
        {
            var express = "var price=100%200.00;";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.VarKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Space, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("price", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("100", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Mod, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("200.00", token.Value);
            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestGreaterSign()
        {
            var express = "var b=100>200.00;";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.VarKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Space, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("b", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("100", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Greater, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("200.00", token.Value);
            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestGreaterOrEqual()
        {
            var express = "var b=100>=200.00;";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.VarKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Space, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("b", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("100", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.GreaterOrEqual, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("200.00", token.Value);
            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestEuqal()
        {
            var express = "var b=100==200.00;";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.VarKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Space, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("b", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("100", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Equal, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("200.00", token.Value);
            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestLess()
        {
            var express = "var b=100<200.00;";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.VarKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Space, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("b", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("100", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Less, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("200.00", token.Value);
            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestLessOrEqual()
        {
            var express = "var b=100<=200.00;";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.VarKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Space, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("b", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("100", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.LessOrEqual, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("200.00", token.Value);
            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestNotEuqal()
        {
            var express = "var b=100!=200.00;";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.VarKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Space, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("b", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("100", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.NotEqual, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("200.00", token.Value);
            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestOr()
        {
            var express = "var b=(price==100||brand==\"李宁\");";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.VarKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Space, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("b", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.LeftBracket, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("price", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Equal, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("100", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Or, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("brand", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Equal, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.String, token.Type);
            Assert.AreEqual("\"李宁\"", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.RightBracket, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestAnd()
        {
            var express = "var b=(price==100&&brand==\"李宁\");";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.VarKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Space, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("b", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.LeftBracket, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("price", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Equal, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("100", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.And, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("brand", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Equal, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.String, token.Type);
            Assert.AreEqual("\"李宁\"", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.RightBracket, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestNot()
        {
            var express = "var b=!(price==100.00);";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.VarKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Space, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("b", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Not, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.LeftBracket, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("price", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Equal, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("100.00", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.RightBracket, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestSetKeyWord()
        {
            var express = "set detail=\"skomart.orderimport.Domain.OutStoreDetail,skomart.orderimport.Domain\";";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.SetKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Space, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("detail", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.String, token.Type);
            Assert.AreEqual("\"skomart.orderimport.Domain.OutStoreDetail,skomart.orderimport.Domain\"", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestForKeyWord()
        {
            var express = "for(var i=0;i<detail.Count;i++){detail.price=0;};";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.ForKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.LeftBracket, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.VarKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Space, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("i", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("0", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("i", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Less, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("detail", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.ClassProperty, token.Type);
            Assert.AreEqual(".Count", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("i", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.SelfAdd, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.RightBracket, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.LeftBrace, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("detail", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.ClassProperty, token.Type);
            Assert.AreEqual(".price", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("0", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.RightBrace, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestIfKeyWord()
        {
            var express = "if(brand>\"李宁\"){price=price*0.8;}else{price=price;};";
            var scanner = new CodeScanner(express);

            var token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.IfKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.LeftBracket, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("brand", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Greater, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.String, token.Type);
            Assert.AreEqual("\"李宁\"", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.RightBracket, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.LeftBrace, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("price", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("price", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Mul, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("0.8", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.RightBrace, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.ElseKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.LeftBrace, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("price", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("price", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.RightBrace, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestNumberic()
        {
            var express = "1234;";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("1234", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);

            express = "1234.1235;";
            scanner = new CodeScanner(express);
            token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.Numberic, token.Type);
            Assert.AreEqual("1234.1235", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestVar()
        {
            var express = "aword;";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("aword", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestString()
        {
            var express = "\"askdfjiew2ewep@#42305()&*(^&^\";";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.String, token.Type);
            Assert.AreEqual("\"askdfjiew2ewep@#42305()&*(^&^\"", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestClassProperty()
        {
            var express = ".Property1;";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.ClassProperty, token.Type);
            Assert.AreEqual(".Property1", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }

        [Test]
        public void TestScanner()
        {
            var express = "var detail=\"skomart.orderimport.Domain.OutStoreDetail,skomart.orderimport.Domain\";";
            var scanner = new CodeScanner(express);
            var token = scanner.GetNextToken();

            Assert.AreEqual(TokenType.VarKeyWord, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Space, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Id, token.Type);
            Assert.AreEqual("detail", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.Assignment, token.Type);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.String, token.Type);
            Assert.AreEqual("\"skomart.orderimport.Domain.OutStoreDetail,skomart.orderimport.Domain\"", token.Value);

            token = scanner.GetNextToken();
            Assert.AreEqual(TokenType.StatementEndSign, token.Type);
        }
    }
}